Show parent Link

Good afternoon. I'm trying to do something: I want that when my current requirement does not have a outlink, it shows the outlink of the parent requirement.
I did the following dxl, but it does not work. I cannot understand the reason why, could someone enlighten me.

Thanks!

 

Object o = current
Object po = parent o
 
Link funcLink
Object funcObj
 
print (o."Object Text") " is child of "(po."Object Heading") "\n"
 
for funcLink in o->"Func to" do {
funcObj = target funcLink

print funcObj."Object Text" ""

if (null funcObj) {
 
for funcLink in po->"Func to" do {
funcObj = target funcLink
print funcObj."Object Text" ""
}
    }
 
}

braolive - Thu Oct 10 12:33:59 EDT 2013

Re: Show parent Link
llandale - Thu Oct 10 12:43:42 EDT 2013

well you are checking the current "o" for no links, but are using a link loop to find the parent loop.  Consider this:

  • funcLink = null
  • for funcLink in o->"Func to" do
  • {   display info for this link
  • }
  • if (null funcLink)
  • {    // "o" has no such outlinks.  Display those from parent
  • }

-Louie

Re: Show parent Link
braolive - Fri Oct 11 06:44:05 EDT 2013

llandale - Thu Oct 10 12:43:42 EDT 2013

well you are checking the current "o" for no links, but are using a link loop to find the parent loop.  Consider this:

  • funcLink = null
  • for funcLink in o->"Func to" do
  • {   display info for this link
  • }
  • if (null funcLink)
  • {    // "o" has no such outlinks.  Display those from parent
  • }

-Louie

Thank you!

It worked! ;-)